package com.yunxi.service.dubboService.impl.dealer;

import com.github.pagehelper.PageInfo;
import com.yunxi.dealer.pojo.PartnerTypeVO;
import com.yunxi.dealer.service.PartnerTypeDubboService;
import com.yunxi.model.dealer.PartnerType;
import com.yunxi.service.localService.dealer.PartnerTypeService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * <p>
 * 渠道商类型 服务实现类
 * </p>
 *
 * @author
 * @since 2019-05-20
 */
//@com.alibaba.dubbo.config.annotation.Service(version = "${demo.service.version}",
//        application = "${dubbo.application.id}",
//        protocol = "${dubbo.protocol.id}",
//        registry = "${dubbo.registry.id}"
//)
public class PartnerTypeDubboServiceImpl implements PartnerTypeDubboService {

   @Autowired
   @Qualifier(value = "partnerTypeServiceImpl")
   PartnerTypeService partnerTypeService;


   @Override
   public PartnerTypeVO getById(String id) throws InvocationTargetException, IllegalAccessException {
      PartnerType partnerType = partnerTypeService.getById(id);
      PartnerTypeVO partnerTypeVO = new PartnerTypeVO();
      BeanUtils.copyProperties(partnerType, partnerTypeVO);
      return partnerTypeVO;
   }

   @Override
   public void saveOrUpdate(PartnerTypeVO partnerTypeVO) throws InvocationTargetException, IllegalAccessException {
      PartnerType partnerType = new PartnerType();
      BeanUtils.copyProperties(partnerTypeVO, partnerType);
      partnerTypeService.saveOrUpdate(partnerType);
   }

   @Override
   public void removeById(String id) {
      partnerTypeService.removeById(id);
   }

   @Override
   public PageInfo<PartnerTypeVO> findPageByVO(PartnerTypeVO partnerTypeVO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {

      PageInfo<PartnerTypeVO> pageInfo = partnerTypeService.pageByVo(partnerTypeVO, pageNum, pageSize);

      return pageInfo;

   }

   @Override
   public void removeByListVo(List<PartnerTypeVO> partnerTypeVOList) throws IllegalAccessException, InvocationTargetException, InstantiationException {
      partnerTypeService.removeByListVo(partnerTypeVOList);
   }

}
